package com.funong.matrix.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum BizCodeEnum {
    /**
     * 模块状态
     */
    DEFAULT("default", "默认"),
    LOGIN("login", "登录"),
    NEW("new", "新增"),
    UPDATE("update", "修改"),
    STATUS("updateStatus", "启用/禁用"),
    DELETE("delete", "删除"),
    LIST("list", "列表查询"),
    BIND("bind", "绑定/解绑"),


    ;

    private String module;
    private String desc;

    public static BizCodeEnum getModule(String module) {
        return Arrays.stream(values())
                .filter(bizCodeEnum -> StringUtils.equals(module, bizCodeEnum.getModule()))
                .findFirst()
                .orElse(DEFAULT);
    }
}
